package com.example.royalchef.adaper;

import android.content.Context;
import android.graphics.Bitmap;
import android.widget.TextView;

import com.example.royalchef.R;
import com.example.royalchef.base.BaseRecyclerViewAdapter;
import com.example.royalchef.base.BaseRecyclerViewHolder;
import com.example.royalchef.bean.CommentInfo;
import com.example.royalchef.view.CircleImageView;
import com.squareup.picasso.Picasso;

import java.util.ArrayList;

/**
 * author: Administrator
 * created on: 2017/7/1 11:35
 * description:
 */

public class HomeDetailAdapter extends BaseRecyclerViewAdapter<CommentInfo.Data> {
    public HomeDetailAdapter(ArrayList<CommentInfo.Data> data, Context context, int layoutId) {
        super(data, context, layoutId);
    }

    @Override
    public void convert(BaseRecyclerViewHolder holder, CommentInfo.Data data, int position, Context context) {
        CircleImageView civMessageAvatar = (CircleImageView) holder.getView(R.id.civ_home_detail_message_avatar);
        TextView tvMessageName = (TextView) holder.getView(R.id.tv_home_detail_message_name);
        //TextView tvMessageTime = (TextView) holder.getView(R.id.tv_home_detail_message_time);
        TextView tvMessageContent = (TextView) holder.getView(R.id.tv_home_detail_massage_content);
        Picasso.with(context)
                .load("http://img.mukewang.com/5523711700016d1606000338-300-170.jpg")
                .resize(50, 50)
                .centerCrop()
                .config(Bitmap.Config.RGB_565)
                .into(civMessageAvatar);
        tvMessageName.setText(data.user.nickname);
        // tvMessageTime.setText(data.createdAt);
        tvMessageContent.setText(data.content);
    }
}
